package 多线程的同步互斥实验数组;

public class ConsumeThread implements Runnable {
    private ProductConsume<Food> p;

    public ConsumeThread(ProductConsume<Food> p) {
        this.p = p;
    }

    @Override
    public void run() {
        for (int i = 1; i <= 20; i++) {
            try {
                p.consume();
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
